/**
 *  角色权限相关
 */

import request from '@/assets/utils/request'

// 获取权限列表
export const getRightList = (params) => {
  return request({
    method: 'GET',
    url: '/permissions',
    params
  })
}

// 新增角色
export const addRole = data => {
  return request({
    method: 'POST',
    url: '/permissions',
    data
  })
}

// 获取角色详情
export const getRoleDetails = roleId => {
  return request({
    method: 'GET',
    url: `/permissions/${roleId}`
  })
}

// 编辑角色详情
export const editRoleRight = (roleId, data) => {
  return request({
    method: 'PUT',
    url: `/permissions/${roleId}`,
    data
  })
}

// 删除角色详情
export const deleteRoleRight = roleId => {
  return request({
    method: 'DELETE',
    url: `/permissions/${roleId}`
  })
}
